# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sniffjoke
pkgver=772.434bfb1
pkgrel=1
license=('GPL')
groups=('blackarch' 'blackarch-defensive' 'blackarch-networking'
        'blackarch-sniffer')
pkgdesc='Injects packets in the transmission flow that are able to seriously disturb passive analysis like sniffing, interception and low level information theft.'
arch=('x86_64' 'aarch64')
url='http://www.delirandom.net/sniffjoke/'
depends=('iptables' 'tcpdump')
makedepends=('git' 'cmake')
source=("git+https://github.com/vecna/$pkgname.git"
        'CMake.patch')
sha512sums=('SKIP'
            'bed70225b877245286c818a58f22e34f8a3a995e52ec1113d5f0f4ad3f93716d2d804d7bdd298a1f7949d31dd10a93b081ecf7892ddf6cc4bb80903083f4eb76')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  patch -p1 -i CMake.patch
}

build() {
  cd $pkgname

  [[ -d build ]] || mkdir build

  cd build

  cmake -DCMAKE_INSTALL_PREFIX=/usr ..

  make
}

package() {
  cd $pkgname

  cd build

  make DESTDIR="$pkgdir" install

  mv "$pkgdir/usr/etc" "$pkgdir/etc"
}

